<HTML>
<HEAD>
<TITLE>SOLDIERS</TITLE>
</HEAD>

<center>
<H1>CEOI 98 Day 2 Problem 1</h1>
<h1>Soldiers</H1>
</center>

<P>
N soldiers of the land Gridland are randomly scattered around the country.

<P>A position in Gridland is given by a pair (x,y) of integer coordinates.
Soldiers can move - in one move, one soldier can go one unit up, down,
left or right (hence, he can change either his x or his y coordinate by
1 or -1).

<P>The soldiers want to get into a horizontal line next to each other (so
that their final positions are (x,y), (x+1,y), ..., (x+N-1,y), for some
x and y). Integers x and y, as well as the final order of soldiers along
the horizontal line is arbitrary.

<P>The goal is to minimise the total number of moves of all the soldiers
that takes them into such configuration.

<P>Two or more soldiers must never occupy the same position at the same
time.

<H2>Input</H2>
The first line of the input file <B>SOLDIERS.IN</B> contains the integer
N, 1&lt;=N&lt;=10000, the number of soldiers.

<P>The following N lines of the input file contain initial positions of
the soldiers : for each i, 1&lt;=i&lt;=N, the (i+1)<SUP>st</SUP>
line of the input file contains a pair of integers x[i] and y[i] separated
by a single blank character, representing the coordinates of the i<SUP>th</SUP>
soldier, -10000&lt;=x[i],y[i]&lt;=10000.

<H2>Output</H2>
The first and the only line of the output file <B>SOLDIERS.OUT</B> should
contain the minimum total number of moves that takes the soldiers into
a horizontal line next to each other.

<H2>Sample Input 1</H2>
<PRE>
3
1 0
2 4
3 2
</PRE>

<h2>Sample Output 1</h2>
<PRE>
4
</PRE>

<h2>Sample Input 2</h2>
<PRE>
5
1 2
2 2
1 3
3 -2
3 3
</PRE>

<h2>Sample Output 2</h2>
<PRE>
8
</PRE>
</BODY>
</HTML>

